package com.huashi.dealer.enums.goods;

import com.huashi.dealer.enums.EnumBasics;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 商品库存计算方式枚举类
 */
@Getter
@AllArgsConstructor
public enum DeductStockType implements EnumBasics {

    // 下单减库存
    CREATE(10, "下单减库存"),

    // 付款减库存
    PAYMENT(20, "付款减库存");

    private final Integer value;
    private final String name;

    /**
     * 获取枚举数据
     * @return 枚举数组
     */
    @Override
    public EnumBasics[] data() {
        return values();
    }

    /**
     * 根据值获取枚举
     * @param value 枚举值
     * @return 枚举对象
     */
    public static DeductStockType getByValue(Integer value) {
        return (DeductStockType) EnumBasics.getByValue(values(), value);
    }
} 